package org.example.web;

import org.example.ZuulProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
@RefreshScope
public class TestDo {

    @Autowired
    ZuulProperties properties;

    @RequestMapping("hello")
    String hello(){
        return "hello spring cloud!";
    }

    @RequestMapping("props")
    ZuulProperties props(){
        return properties;
    }

}

/**
 * Zuul过滤器解决无会话登录问题
 *
 * /user/login/login => damai-user => 会话保存用户信息
 *        result => ok => zuul拦截响应, 将用户信息取出, 生成 jwt token
 *        将 jwt 返回浏览器 ( cookie(推荐), sessionStorge, localStorge )
 *               => fail => 直接返回
 *        后置拦截
 *
 *
 * /user/login/myinfo => damai-user => 取出会话中的用户信息
 *      zuul 前置拦截 => jwt解析 => 直接返回用户信息
 *
 *
 * /User/login/logout => damai-user => 手动会话失效
 *      zuul 前置拦截  => 将 cookie 中的jwt直接移除
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */
